package chapter01;

import java.util.Arrays;

public class Test24_Sort {
    public static void main(String[] args) {
        int[] a = {1,24,1,4,2,5,6,31,41,21};
        sort(a);
        System.out.println(Arrays.toString(a));
    }
    public static void sort(int[] a){
        //冒泡排序
        for(int j=0;j<a.length;j++){
            for(int i=0;i<a.length-1-j;i++){
                if(a[i]>a[i+1]){
                    int temp = a[i];
                    a[i] = a[i+1];
                    a[i+1] = temp;
                }
            }
        }

    }
}
